import request from '@/utils/request'
import qs from 'qs'

// 获取所有口味
export function getFoodTypeList (pageNumber, pageSize) {
  return request({
    url: 'food_type/list_rewrite',
    method: 'get',
    params: {
      pageNumber,
      pageSize
    }
  })
}

// 获取所有口味
export function getAllFoodTypeList () {
  return request({
    url: 'food_type/list_selects',
    method: 'get'
  })
}


// 添加口味
export function addFoodType (data) {
  return request({
    url: '/food_type/save_rewrite',
    method: 'post',
    data: qs.stringify(
      data
    )
  })
}

// 删除口味
export function deleteFoodTypes (ids) {
  return request({
    url: '/food_type/delete',
    method: 'post',
    data: qs.stringify({
      ids
    }, {indices: false})
  })
}

// 编辑口味
export function updateFoodType (foodTypeInfo) {
  return request({
    url: '/food_type/update',
    method: 'post',
    data: qs.stringify({
      id: foodTypeInfo.id,
      name: foodTypeInfo.name,
      rank: foodTypeInfo.rank,
      priority: foodTypeInfo.priority
    }, {indices: false})
  })
}
